﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Campus.Main.Basic.Settings;
using dbcntn;

namespace Campus.Main.Basic.InsertValues
{
    public partial class MaddeNo : Default
    {
        public MaddeNo()
        {
            InitializeComponent();
            aToDb=new ConnectionToDb(Helper._connectionString);
            button1.Click += button1_Click;
        }

        public MaddeNo(List<string> item):base(item)
        {
            InitializeComponent();
            aToDb = new ConnectionToDb(Helper._connectionString);
            textBox1.Text = item[1];
            button1.Click += button1_Click_1;
        }

        private void button1_Click_1(object sender, EventArgs e)
        {
            if (textBox1.Text.Length > 0)
            {
                //int a = Int32.Parse(textBox1.Text);
                aToDb.UpdateTable("maddeno", "description", textBox1.Text,id);
                Close();
            }
            else
            {
                textBox1.Clear();
                MessageBox.Show("Талааны толтургула!!!");
            }
        }

        protected override void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text.Length > 0)
            {
                int a = Int32.Parse(textBox1.Text);
                aToDb.InsertIntoTable("maddeno", "description", a);
                MessageBox.Show("Eklendi");
                textBox1.Clear();
            }
            else
            {
                textBox1.Clear();
                MessageBox.Show("Талааны толтургула!!!");
            }
        }

        private void MaddeNo_Load(object sender, EventArgs e)
        {

        }

        
    }
}
